﻿/*
 * 版 本 Learun-ADMS V7.0.3 敏捷开发框架
 * Copyright (c) 2013-2018 Hexagon PPM
 * 创建人：前端开发组
 * 日 期：2017.03.16
 * 描 述：admin顶层页面操作方法
 */

var loaddfimg;
var userId;
var htmlmenu = '';
var ProjectId = request("ProjectId");
var page
(function ($, learun) {
    "use strict";
    page = {
        init: function () {
            /*判断当前浏览器是否是IE浏览器*/
            if ($('body').hasClass('IE') || $('body').hasClass('InternetExplorer')) {
                //$('#lr_loadbg').append('<img src="' + top.$.rootUrl + '/Content/images/ie-loader.gif" style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;margin: auto;vertical-align: middle;">');
                //Pace.stop();
            }
            else {
                //Pace.on('done', function () {
                //    $('#lr_loadbg').fadeOut();
                //    Pace.options.target = '#learunpacenone';
                //});
            }
            // 通知栏插件初始化设置
            toastr.options = {
                "closeButton": true,
                "debug": false,
                "newestOnTop": true,
                "progressBar": false,
                "positionClass": "toast-top-center",
                "preventDuplicates": false,
                "onclick": null,
                "showDuration": "300",
                "hideDuration": "1000",
                "timeOut": "3000",
                "extendedTimeOut": "1000",
                "showEasing": "swing",
                "hideEasing": "linear",
                "showMethod": "fadeIn",
                "hideMethod": "fadeOut"
            };
            // 打开单位首页
            if (pageid == 'AdminSystemManage') {
                learun.frameTab.open({ F_ModuleId: '21fb2570-8ad7-4a08-8de4-2b9bd2d3f134', F_Icon: 'fa fa-desktop', F_FullName: '首页', F_UrlAddress: '/Home/AdminSystemPageIndex?ProjectId=' }, true);
            }
            if (pageid == 'AdminProjectManage') {
                learun.frameTab.open({ F_ModuleId: '21fb2570-8ad7-4a08-8de4-2b9bd2d3f134', F_Icon: 'fa fa-desktop', F_FullName: '首页', F_UrlAddress: '/Home/AdminSystemPageIndex?ProjectId=' + ProjectId }, true);
                $.ajax({
                    type: 'get', url: top.$.rootUrl + '/ZZDT_EC/ec_project/GetProjectById/?ProjectId=' + ProjectId, async: false,
                    success: (data) => {
                        let datajson = JSON.parse(data).data.ec_project;
                        $("#lr-frame-project").text(datajson.ProjectName);
                        var prjectwidth = $("#lr-frame-project").width();
                        $(".lr-frame-tabs").css("padding-left", (50+50 + 15 + prjectwidth) + "px");
                        $(".lr-frame-tabs").css("padding-right", (330 + 115) + "px");
                    }
                });
                //1审批2传阅3加签4子流程5重新创建[ShortcutEntrance(快捷入口)]；
                switch (parseInt(taskType)) {
                    case 1:// 审批
                        learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '审批-' + title + '/' + taskName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + taskId + '&type=audit' + "&processId=" + processId + "&taskId=" + taskId + "&ShortcutEntrance=1" });
                        break;
                    case 2:// 传阅
                        learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '查阅-' + title + '/' + taskName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + taskId + '&type=refer' + "&processId=" + processId + "&taskId=" + taskId + "&ShortcutEntrance=1" });
                        break;
                    case 3:// 加签
                        learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '加签审核-' + title + '/' + taskName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + taskId + '&type=signAudit' + "&processId=" + processId + "&taskId=" + taskId + "&ShortcutEntrance=1" });
                        break;
                    case 4:// 子流程
                        learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '子流程-' + title + '/' + taskName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + taskId + '&type=chlid' + "&processId=" + processId + "&taskId=" + taskId + "&ShortcutEntrance=1" });
                        break;
                    case 5:// 重新创建
                        learun.frameTab.open({ F_ModuleId: processId, F_Icon: 'fa magic', F_FullName: '重新发起-' + title, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?processId=' + processId + '&tabIframeId=' + processId + '&type=againCreate' + "&ShortcutEntrance=1" });
                        break;
                    case 6:// 重新创建
                        learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '子流程-' + title + '/' + taskName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + taskId + '&type=againChild' + "&processId=" + processId + "&taskId=" + taskId + "&ShortcutEntrance=1" });
                        break;
                }
            }
            learun.clientdata.init(function () {
                userId = learun.clientdata.get(['userinfo']).userId;

                // 加载待办任务列表
                top.learun.httpAsync('GET', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/GetTaskPageList', {
                    queryJson: "{}", categoryId: 2, ProjectId: ProjectId, pagination: JSON.stringify({ "rows": 9, "page": 1, "sidx": "F_CreateDate DESC", "sord": "ASC", "records": 0, "total": 0 })
                }, function (data) {
                    var htmltodo = "";
                    if (data) {
                        if (data.rows.length > 0) {
                            htmltodo += '<span>待办事项</span><span id="daiban" style="color:red;">(' + data.records + ')</span>';
                        } else {
                            htmltodo += '<span>待办事项</span></span>';
                        }
                    }
                    page.userInit(htmltodo);
                    //加载用户常用功能
                    page.functionMenuID(userId);
                });
                // 初始页面特例
                bootstrap($, learun);
                if ($('body').hasClass('IE') || $('body').hasClass('InternetExplorer')) {
                    //$('#lr_loadbg').fadeOut();
                }

                // 3.具体某一个页面
                var moduleCode = request("moduleCode");
                if (moduleCode) {
                    var modulesCodeMap = learun.clientdata.get(['modulesCodeMap']);
                    if (modulesCodeMap[moduleCode]) {
                        learun.frameTab.open(modulesCodeMap[moduleCode]);
                    }
                }
            });

            // 加载数据进度
            page.loadbarInit();
            // 全屏按钮
            page.fullScreenInit();
            // 主题选择初始化
            page.uitheme();
            // 监听页面传递参数：支持打开流程页面
            // 1.流程发起
            var _schemeCode = request("schemeCode");
            if (_schemeCode) {
                learun.frameTab.open({ F_ModuleId: _schemeCode, F_Icon: 'fa magic', F_FullName: '创建流程', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?shcemeCode=' + _schemeCode + '&tabIframeId=' + _schemeCode + '&type=create' });
            }
            // 2.流程审核
            var _taskId = request("taskId");
            if (_taskId) {
                // 获取下流程任务
                learun.httpAsync('GET', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/GetTask', { taskId: _taskId }, function (data) {
                    if (data) {
                        //1审批2传阅3加签4子流程5重新创建
                        switch (data.F_Type) {
                            case 1:// 审批
                                learun.frameTab.open({ F_ModuleId: _taskId, F_Icon: 'fa magic', F_FullName: '审批-' + data.F_NodeName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + _taskId + '&type=audit' + "&processId=" + data.F_ProcessId + "&taskId=" + _taskId });
                                break;
                            case 2:// 传阅
                                learun.frameTab.open({ F_ModuleId: _taskId, F_Icon: 'fa magic', F_FullName: '查阅-' + data.F_NodeName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + _taskId + '&type=refer' + "&processId=" + data.F_ProcessId + "&taskId=" + _taskId });
                                break;
                            case 3:// 加签
                                learun.frameTab.open({ F_ModuleId: _taskId, F_Icon: 'fa magic', F_FullName: '加签审核-' + data.F_NodeName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + _taskId + '&type=signAudit' + "&processId=" + data.F_ProcessId + "&taskId=" + _taskId });
                                break;
                            case 4:// 子流程
                                learun.frameTab.open({ F_ModuleId: _taskId, F_Icon: 'fa magic', F_FullName: '子流程-' + data.F_NodeName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + _taskId + '&type=chlid' + "&processId=" + data.F_ProcessId + "&taskId=" + _taskId });
                                break;
                            case 5:// 重新创建
                                learun.frameTab.open({ F_ModuleId: data.F_ProcessId, F_Icon: 'fa magic', F_FullName: '重新发起', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?processId=' + data.F_ProcessId + '&tabIframeId=' + data.F_ProcessId + '&type=againCreate' });
                                break;
                            case 6:// 重新创建
                                learun.frameTab.open({ F_ModuleId: _taskId, F_Icon: 'fa magic', F_FullName: '子流程-' + data.F_NodeName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + _taskId + '&type=againChild' + "&processId=" + data.F_ProcessId + "&taskId=" + _taskId });
                                break;
                        }
                    }
                });
            }
        },
        //加载用户常用功能
        functionMenuID: function (userId) {
            //// 加载常用功能列表
            //$.ajax({
            //    type: 'GET',
            //    url: top.$.rootUrl + '/GZDT_BDPM/CommonFunctions/GetFormData?userId=' + userId,
            //    data: {},
            //    traditional: true,
            //    async: false,
            //    success: function (data) {
            //        var functionMenuIDs = JSON.parse(data).data.functionMenuIDs;
            //        //加载用户常用功能里面的菜单名称
            //        page.functionMenuName(functionMenuIDs);
            //        //page.userInit(htmltodo, htmlmenu);
            //    },
            //    error: function (msg) {

            //    }, complete: function (data) {
            //    }
            //});
        },
        //加载用户常用功能里面的菜单名称
        functionMenuName: function (functionMenuIDs) {
            //$.ajax({
            //    type: 'GET',
            //    url: top.$.rootUrl + '/GZDT_BDPM/CommonFunctions/GetMenuFormData?functionMenuIDs=' + functionMenuIDs,
            //    data: {},
            //    traditional: true,
            //    async: false,
            //    success: function (data) {
            //        var listMenu = JSON.parse(data).data.listMenu;
            //        $("#CommonFunctions").html("");
            //        htmlmenu = '';
            //        htmlmenu += '<li style="border-bottom: 1px solid gray"><a href="javascript:void(0);" id="SetCommonFunctions"><i class="fa fa-gear"></i><span>设置</span></a></li>';
            //        if (listMenu.length > 0) {
            //            for (var item in listMenu) {
            //                var menu = listMenu[item].split('|');
            //                var menuName = menu[0];
            //                var menuIcon = menu[1];
            //                var menuUrl = menu[2];
            //                var ModuleId = menu[3];
            //                htmlmenu += '<li urladdress="' + menuUrl + '" F_ModuleId="' + ModuleId + '" name="' + menuName + '" icon="' + menuIcon + '"><a href="javascript:void(0);"><i class="' + menuIcon + '"></i><span>' + menuName + '</span></a></li>';
            //            }
            //        }
            //        $("#CommonFunctions").append($(htmlmenu));
            //        $("#CommonFunctions li").click(function () {
            //            var url = $(this).attr("urladdress");
            //            var name = $(this).attr("name");
            //            var icon = $(this).attr("icon");
            //            var F_ModuleId = $(this).attr("F_ModuleId");
            //            if (name) {
            //                learun.frameTab.open({ F_ModuleId: F_ModuleId, F_Icon: icon, F_FullName: name, F_UrlAddress: url });
            //            }
            //        })
            //        $("#SetCommonFunctions").click(function () {
            //            learun.layerForm({
            //                id: '',
            //                title: '常用功能编辑',
            //                url: top.$.rootUrl + '/GZDT_BDPM/CommonFunctions/Form',
            //                width: 550,
            //                height: 690,
            //                btn: null
            //            });
            //        });
            //    },
            //    error: function (msg) {

            //    }, complete: function (data) {
            //    }
            //});
        },
        // 登录头像和个人设置
        userInit: function (htmltodo) {
            var loginInfo = learun.clientdata.get(['userinfo']);
            var _html = ''
            if (pageid == 'AdminProjectManage') {
                let ProjectId = request('ProjectId');
                ////消息提醒
                //$.ajax({
                //    type: 'get', url: top.$.rootUrl + '/LR_IM/IMMsg/GetMsgNotReadNum?ProjectId=' + ProjectId, async: false,
                //    success: (data) => {
                //        let datajson = JSON.parse(data);
                //        _html += '<div class="lr-frame-personCenter lr-frame-personCenter2" style="right:355px!important;" back="backiu">';
                //        _html += '<a title="消息提醒" href="javascript:;" id="lr_msg_btn" class="dropdown-toggle" data-toggle="dropdown">';
                //        _html += '<i class="fa fa-bell" style="color: #333;margin-right: 5px;font-size: 14px;"></i>';
                //        if (datajson.data.data == 0) {
                //            _html += '<span>消息提醒</span><span style="color:red;" id="getMsgCount"></span>';
                //        } else {
                //            _html += '<span>消息提醒</span><span style="color:red;" id="getMsgCount">(' + datajson.data.data + ')</span>';
                //        }
                //        _html += '</a></div>';
                //    }
                //});
                //// 待办事项
                //_html += '<div class="lr-frame-personCenter lr-frame-personCenter1" style="right:270px!important;" back="backiu"><a href="javascript:void(0);" id="linkToDo" class="dropdown-toggle" data-toggle="dropdown">';
                //_html += '<i class="fa fa-paper-plane-o" style="color: #333;margin-right: 5px;font-size: 13px;"></i>';
                //_html += htmltodo;
                //_html += '</a></div>';
                // 项目切换
                _html += '<div class="lr-frame-personCenter lr-frame-personCenter1" style="right: 185px!important;" back="backiu"><a title="线路切换" href="javascript:void(0);" id="lr_projects_btn" class="dropdown-toggle" data-toggle="dropdown">';
                _html += '<i class="fa fa-random" style="color: #333;margin-right: 5px;font-size: 13px;"></i>';
                _html += '<span>项目切换</span>';
                _html += '</a></div>';
                // 单位平台
                _html += '<div class="lr-frame-personCenter lr-frame-personCenter1" style="right: 100px!important;" back="backiu"><a title="返回主页" href="#" id="lr_systemmanage_btn" class="dropdown-toggle" data-toggle="dropdown">';
                _html += '<i class="fa fa-backward" style="color: #333;margin-right: 5px;font-size: 13px;"></i>';
                _html += '<span>返回主页</span>';
                _html += '</a></div>';

            } else if (pageid == 'AdminSystemManage') {
                ////消息提醒
                //$.ajax({
                //    type: 'get', url: top.$.rootUrl + '/LR_IM/IMMsg/GetMsgNotReadNum?ProjectId=', async: false,
                //    success: (data) => {
                //        let datajson = JSON.parse(data);
                //        _html += '<div class="lr-frame-personCenter lr-frame-personCenter2" style="right:270px!important;" back="backiu">';
                //        _html += '<a title="消息提醒" href="javascript:;" id="lr_msg_btn" class="dropdown-toggle" data-toggle="dropdown">';
                //        _html += '<i class="fa fa-bell" style="color: #333;margin-right: 5px;font-size: 14px;"></i>';
                //        if (datajson.data.data == 0) {
                //            _html += '<span>消息提醒</span><span style="color:red;" id="getMsgCount"></span>';
                //        } else {
                //            _html += '<span>消息提醒</span><span style="color:red;" id="getMsgCount">(' + datajson.data.data + ')</span>';
                //        }
                //        _html += '</a></div>';
                //    }
                //});
                //// 待办事项
                //_html += '<div class="lr-frame-personCenter lr-frame-personCenter1" style="right:185px!important;" back="backiu"><a href="javascript:void(0);" id="linkToDo" class="dropdown-toggle" data-toggle="dropdown">';
                //_html += '<i class="fa fa-paper-plane-o" style="color: #333;margin-right: 5px;font-size: 13px;"></i>';
                //_html += htmltodo;
                //_html += '</a></div>';
                //项目平台
                _html += '<div class="lr-frame-personCenter lr-frame-personCenter1" style="right:100px!important;" back="backiu"><a title="" href="javascript:void(0);" id="lr_projects_btn" class="dropdown-toggle" data-toggle="dropdown">';
                _html += '<i class="fa fa-random" style="color: #333;margin-right: 5px;font-size: 13px;"></i>';
                _html += '<span>项目选择</span>';
                _html += '</a></div>';
            }
            // 用户信息
            _html += '<div class="lr-frame-personCenter lr-frame-personCenter4" style="right: 15px!important;" back="backiu"><a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">';
            _html += '<img id="userhead"src="' + top.$.rootUrl + '/LR_OrganizationModule/User/GetImg?userId=' + loginInfo.userId + '" >';
            _html += '<span>' + loginInfo.realName + '</span><i style="color: #333;margin-left: 5px;" class="fa fa-caret-down"></i>';
            _html += '</a>';
            _html += '<ul class="dropdown-menu pull-right">';
            _html += '<li><a href="javascript:void(0);" id="lr_userinfo_btn"><i class="fa fa-user"></i><span>个人信息</span></a></li>';
            if (loginInfo.isSystem) {
                _html += '<li><a href="javascript:void(0);" id="lr_clearredis_btn"><i class="fa fa-refresh"></i><span>清空缓存</span></a></li>';
            }
            _html += '<li><a href="javascript:void(0);" id="lr_loginout_btn"><i class="fa fa-power-off"></i><span>安全退出</span></a></li>';
            _html += '</ul></div>';

            $('body').append(_html);

            // 语言包翻译
            $('.lr-frame-personCenter span').each(function () {
                var $this = $(this);
                var text = $this.text();
                learun.language.get(text, function (text) {
                    $this.text(text);
                });
            });
            $('#lr_systemmanage_btn').on('click', page.systemmanage);
            $('#lr_projects_btn').on('click', page.projects);
            $('#lr_portal_btn').on('click', page.portal);
            $('#lr_loginout_btn').on('click', page.loginout);
            $('#lr_userinfo_btn').on('click', page.openUserCenter);
            $('#lr_clearredis_btn').on('click', page.clearredis);
            $("#linkToDo").on('click', page.toDo);
            $("#SetCommonFunctions").click('click', page.SetCommonFunctions);
            // 项目选择
            $('#lr_projects_btn').on('click', function () {
                learun.layerForm({
                    id: 'form',
                    title: '项目选择',
                    url: top.$.rootUrl + '/ZZDT_EC/ec_project/ProjectListIndex',
                    width: 1200,
                    height: 600,
                    btn: null,
                    callBack: function (id) {
                       
                    }
                });
            });
            //消息提醒
            $('#lr_msg_btn').click(() => {
                learun.frameTab.open({ F_ModuleId:"68F150C8-03BC-421C-9D8B-8CD6BB65F7B7",F_Icon: 'fa magic', F_FullName: '消息中心', F_UrlAddress: '/LR_IM/IMMsg/Index' });
            });
        },
        systemmanage: function () { // 系统管理
            window.location.href = $.rootUrl + '/Home/AdminSystemManage?moduleCode=AdminSystemPageIndex';
        },
        projects: function () { // 项目选择
            learun.layerForm({
                id: 'form',
                title: '项目选择',
                url: top.$.rootUrl + '/ZZDT_EC/ec_project/ProjectListIndex',
                width: 1200,
                height: 600,
                btn: null,
                callBack: function (id) {
                    return top[id].GetProjectId();
                }
            });
        },
        portal: function () { // 个人门户
            window.location.href = $.rootUrl + "/Home/Portal";
        },
        loginout: function () { // 安全退出
            learun.layerConfirm("注：您确定要安全退出本次登录吗？", function (r) {
                if (r) {
                    learun.loading(true, '退出系统中...');
                    learun.httpAsyncPost($.rootUrl + '/Login/OutLogin', {}, function (data) {
                        window.location.href = $.rootUrl + "/Login/Index";
                    });
                }
            });
        },
        clearredis: function () {
            learun.layerConfirm("注：您确定要清空全部后台缓存数据吗？", function (r) {
                if (r) {
                    learun.loading(true, '清理缓存数据中...');
                    learun.httpAsyncPost($.rootUrl + '/Home/ClearRedis', {}, function (data) {
                        window.location.href = $.rootUrl + "/Login/Index";
                    });
                }
            });
        },
        openUserCenter: function () {
            // 打开个人中心
            learun.frameTab.open({ F_ModuleId: '1123', F_Icon: 'fa fa-user', F_FullName: '个人中心', F_UrlAddress: '/UserCenter/Index' });
        },

        toDo: function () {
            if ($("#lr_frame_tabs_ul").find("li[id='lr_tab_56ce34c2-882e-47d1-b12d-5036e3b79fcf']").length <= 0) {
                learun.frameTab.open({ F_ModuleId: '56ce34c2-882e-47d1-b12d-5036e3b79fcf', F_Icon: 'fa fa-user', F_FullName: '流程任务', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/Index' });
            }
        },
        // 全屏按钮
        fullScreenInit: function () {
            var _html = '<div class="lr_frame_fullscreen"><a href="javascript:void(0);" id="lr_fullscreen_btn" title="全屏"><i class="fa fa-arrows-alt"></i></a></div>';
            $('body').append(_html);
            $('#lr_fullscreen_btn').on('click', function () {
                if (!$(this).attr('fullscreen')) {
                    $(this).attr('fullscreen', 'true');
                    page.requestFullScreen();
                } else {
                    $(this).removeAttr('fullscreen');
                    page.exitFullscreen();
                }
            });
        },
        requestFullScreen: function () {
            var de = document.documentElement;
            if (de.requestFullscreen) {
                de.requestFullscreen();
            } else if (de.mozRequestFullScreen) {
                de.mozRequestFullScreen();
            } else if (de.webkitRequestFullScreen) {
                de.webkitRequestFullScreen();
            }
        },
        exitFullscreen: function () {
            var de = document;
            if (de.exitFullscreen) {
                de.exitFullscreen();
            } else if (de.mozCancelFullScreen) {
                de.mozCancelFullScreen();
            } else if (de.webkitCancelFullScreen) {
                de.webkitCancelFullScreen();
            }
        },

        // 加载数据进度
        loadbarInit: function () {
            var _html = '<div class="lr-loading-bar" id="lr_loading_bar" >';
            _html += '<div class="lr-loading-bar-bg"></div>';
            _html += '<div class="lr-loading-bar-message" id="lr_loading_bar_message"></div>';
            _html += '</div>';
            $('body').append(_html);
        },

        // 皮肤主题设置
        uitheme: function () {
            var uitheme = top.$.cookie('Learn_ADMS_V6.1_UItheme') || '1';
            var $setting = $('<div class="lr-theme-setting" style="display:none"></div>');
            var $btn = $('<button class="btn btn-default"><i class="fa fa-spin fa-gear"></i></button>');
            var _html = '<div class="panel-heading lrlg">界面风格</div>';
            _html += '<div class="panel-body">';
            _html += '<div><label><input type="radio" name="ui_theme" value="1" ' + (uitheme == '1' ? 'checked' : '') + '><span class="lrlg" >经典版</span></label></div>';
            _html += '<div><label><input type="radio" name="ui_theme" value="2" ' + (uitheme == '2' ? 'checked' : '') + '><span class="lrlg" >风尚版</span></label></div>';
            _html += '<div><label><input type="radio" name="ui_theme" value="3" ' + (uitheme == '3' ? 'checked' : '') + '><span class="lrlg" >炫动版</span></label></div>';
            _html += '<div><label><input type="radio" name="ui_theme" value="4" ' + (uitheme == '4' ? 'checked' : '') + '><span class="lrlg" >飞扬版</span></label></div>';
            _html += '</div>';
            $setting.append($btn);
            $setting.append(_html);
            $('body').append($setting);

            $('.lr-theme-setting .lrlg').each(function () {
                var $this = $(this);
                var text = $this.text();
                learun.language.get(text, function (text) {
                    $this.text(text);
                });
            });


            $btn.on('click', function () {
                var $parent = $(this).parent();
                if ($parent.hasClass('opened')) {
                    $parent.removeClass('opened');
                }
                else {
                    $parent.addClass('opened');
                }
            });
            $setting.find('input').click(function () {
                var value = $(this).val();
                top.$.cookie('Learn_ADMS_V6.1_UItheme', value, { path: "/Home/", httpOnly: true });
                location.reload();
            });

        },
    };

    $(function () {
        var prjectwidth = $("#lr-frame-project").width();
        $(".lr-frame-tabs").css("padding-left", (440 + 15 + prjectwidth) + "px");
        page.init();
    });
})(window.jQuery, top.learun);

var loadPageFn = function () {
    page.functionMenuID(userId);
}

window.loadPageFn = loadPageFn